import axios from 'axios';
import qs from 'qs';

//发送验证码
export function sendCode(phoneNumber){
    let url='/common/sendverifycode';
    let data={
        mobile:phoneNumber
    }
    return axios.post(url,qs.stringify(data));
}

//用户登录
export function login(username,password,agent,gameId){
    let url='/member/login';
    let data={
        username:username,
        password:password,
        agent:agent,
        gameId:gameId
    }
    return axios.get(url, {params: data});
}

//验证手机号是否存在
export function phoneExist(phone,type){
    let url='/member/login';
    let data={
        phone:phone,
        type:type
    }
    return axios.get(url, {params: data});
}

//修改密码
export function editPassword(password,password_new){
    let url='/sdk/edit-password';
    let data={
		password:password,
		password_new:password_new
    }
    return axios.post(url,qs.stringify(data));
}

//找回密码
export function retrievePassword(password_new,phone,code){
    let url='/sdk/retrieve-password';
    let data={
		phone:phone,
		password_new:password_new,
		code:code
    }
    return axios.post(url,qs.stringify(data));
}